/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ifpb.banco.entity;

import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author Vanderlan
 */
@Entity
@Table(catalog = "", schema = "VANDERLAN")
@SequenceGenerator(name = "S_FORNECEDOR_PK", sequenceName = "S_FORNECEDOR_PK") 
public class Fornecedor extends Identificavel{
    private static final long serialVersionUID = 1L;

    @Id
    @Basic(optional = false)
    @Column(name = "COD_FORNECEDOR", nullable = false, precision = 0, scale = -127)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "S_FORNECEDOR_PK")
    protected Long id;
    @Basic(optional = false)
    @Column(nullable = false)
    private long cnpj;
    @Basic(optional = false)
    @Column(name = "NOME_FANTASIA", nullable = false, length = 40)
    private String nomeFantasia;
    @Basic(optional = false)
    @Column(name = "RAZAO_SOCIAL", nullable = false, length = 40)
    private String razaoSocial;
    @Basic(optional = false)
    @Column(name = "TELEFONE_FIXO", nullable = false)
    private long telefoneFixo;
    @Basic(optional = false)
    @Column(nullable = false)
    private long celular;
    @Column(length = 40)
    private String representante;
    @Basic(optional = false)
    @Column(nullable = false, length = 40)
    private String rua;
    @Basic(optional = false)
    @Column(nullable = false, length = 40)
    private String bairro;
    private BigInteger numero;
    @Basic(optional = false)
    @Column(nullable = false, length = 10)
    private String cep;
    @OneToMany(mappedBy = "codFornecedor")
    private Collection<Fornecimento> fornecimentoCollection;

    public Fornecedor() {
    }

    public Fornecedor(Long codFornecedor) {
        this.id = codFornecedor;
    }

    public Fornecedor(Long codFornecedor, long cnpj, String nomeFantasia, String razaoSocial, long telefoneFixo, long celular, String rua, String bairro, String cep) {
        this.id = codFornecedor;
        this.cnpj = cnpj;
        this.nomeFantasia = nomeFantasia;
        this.razaoSocial = razaoSocial;
        this.telefoneFixo = telefoneFixo;
        this.celular = celular;
        this.rua = rua;
        this.bairro = bairro;
        this.cep = cep;
    }

    public Long getCodFornecedor() {
        return id;
    }

    public void setCodFornecedor(Long codFornecedor) {
        this.id = codFornecedor;
    }

    public long getCnpj() {
        return cnpj;
    }

    public void setCnpj(long cnpj) {
        this.cnpj = cnpj;
    }

    public String getNomeFantasia() {
        return nomeFantasia;
    }

    public void setNomeFantasia(String nomeFantasia) {
        this.nomeFantasia = nomeFantasia;
    }

    public String getRazaoSocial() {
        return razaoSocial;
    }

    public void setRazaoSocial(String razaoSocial) {
        this.razaoSocial = razaoSocial;
    }

    public long getTelefoneFixo() {
        return telefoneFixo;
    }

    public void setTelefoneFixo(long telefoneFixo) {
        this.telefoneFixo = telefoneFixo;
    }

    public long getCelular() {
        return celular;
    }

    public void setCelular(long celular) {
        this.celular = celular;
    }

    public String getRepresentante() {
        return representante;
    }

    public void setRepresentante(String representante) {
        this.representante = representante;
    }

    public String getRua() {
        return rua;
    }

    public void setRua(String rua) {
        this.rua = rua;
    }

    public String getBairro() {
        return bairro;
    }

    public void setBairro(String bairro) {
        this.bairro = bairro;
    }

    public BigInteger getNumero() {
        return numero;
    }

    public void setNumero(BigInteger numero) {
        this.numero = numero;
    }

    public String getCep() {
        return cep;
    }

    public void setCep(String cep) {
        this.cep = cep;
    }

    public Collection<Fornecimento> getFornecimentoCollection() {
        return fornecimentoCollection;
    }

    public void setFornecimentoCollection(Collection<Fornecimento> fornecimentoCollection) {
        this.fornecimentoCollection = fornecimentoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fornecedor)) {
            return false;
        }
        Fornecedor other = (Fornecedor) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ifpb.banco.principal.entity.Fornecedor[ codFornecedor=" + id + " ]";
    }
    
}
